package com.cxria.problem.dao

import com.cxria.problem.entity.User;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
class UserDaoTest {

    @Autowired
    UserDao userDao;

    @Test
    void testFindAll() {
        List<User> users = userDao.findAll()
        System.out.println(users)
        Assert.assertNotNull(users.get(0).username)
    }

    @Test
    void testFindOne() {
        def user = userDao.findOne(null, 'maomao')
        print user
        Assert.assertNotNull(user.username)
    }

}